/**
 * 
 */
package org.cuatrovientos.vehicle;

import java.util.Random;

/**
 * father class from vehicle
 * @author Isma
 *
 */
public class Vehicle {
	protected String name;
	protected int speed;
	protected int gas;
	protected int drift;
	protected Random rnd = new Random();
	/**
     * Constructor
     * @param name
     */
    public Vehicle (String name){
            this.name=name;
            starting();
    }
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the speed
	 */
	public int getSpeed() {
		return speed;
	}
	/**
	 * @param velocity the velocity to set
	 * @param speed 
	 */
	public void setVelocity(int velocity, int speed) {
		this.speed = speed;
	}
	/**
	 * @return the gas
	 */
	public int getGas() {
		return gas;
	}
	/**
	 * @param gas the gas to set
	 */
	public void setGas(int gas) {
		this.gas = gas;
	}
	/**
	 * @return the drift
	 */
	public int getDrift() {
		return drift;
	}
	/**
	 * @param drift the drift to set
	 */
	public void setDrift(int drift) {
		this.drift = drift;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Vehicle [name=" + name + ", speed=" + speed + ", gas=" + gas
				+ ", drift=" + drift + "]";
	}
	/**
	 * give random values to the cars
	 */
	private void starting(){
		
		
		for (int i=0;i<18;i++){
			
			switch (rnd.nextInt(3)) {
			
			case 0:
						speed++;
						break;
			
			case 1:	
						gas++;
						break;
			case 2:
						drift++;
						break;
			
						
			}
			
		}
		
	}
	/**
	 * move the car
	 * @return
	 */
	public int move(){
		return speed+ gas + rnd.nextInt(6);
	}
	/**
	 * manoeuvre the car
	 * @return
	 */
	public int thePlays(){
		return drift + rnd.nextInt(6);
	}
}
